function [a,b] = Householder(x)
%Householder变换 计算householder变换矩阵H
%   注意H将x变为e1
n = height(x);
m = max(x);
x = x/m;
s = x(2:n)'*x(2:n);
v(2:n) = x(2:n);
if s == 0
    Beta = 0;
else
    y = sqrt(x(1)^2 + s);
    if x(1) <= 0
        v(1) = x(1) - y;
    else
        v(1) = -s/(x(1) + y);
    end
    Beta = 2*v(1)^2/(s + v(1)^2);
    v = v/v(1);
end
a = v;
b = Beta;
end

